<p id="notice"><%= notice %></p>

<p>
  <strong>标题:</strong>
  <%= @article.title %>
</p>

<p>
  <strong>类别:</strong>
  <%= @article.category %>
</p>

<p>
  <strong>tags:</strong>
  <%= @article.tags %>
</p>

<p>
  <strong>封面:</strong>
  <%= image_tag @article.cover.url(:small) if @article.cover %>
</p>

<p>
  <strong>置顶:</strong>
  <%= @article.top %>
</p>

<p>
  <strong>置顶图:</strong>
  <%= image_tag @article.top_cover.url(:small) if @article.top_cover %>
</p>

<p>
  <strong>置顶时间:</strong>
  <%= @article.top_at %>
</p>

<p>
  <strong>pdf:</strong>
  <%= @article.read_attribute(:pdf) %>
</p>

<p>
  <strong>相关产品:</strong>
  <ul>
  <% @article.products.each do |product| %>
		<li><%= link_to product.title, admin_product_path(product) %></li>
  <% end %>
  </ul>
</p>

<p>
  <strong>简介:</strong>
  <%= @article.description %>
</p>

<p>
  <strong>发布时间(utc):</strong>
  <%= @article.publish_time %>
</p>

<p>
  <strong>内容:</strong>
  
  <%= @article.content.html_safe %>
</p>

<h1>图片列表</h1>

<% @uploads.each do |upload| %>
  <span id="upload-<%=upload.id%>">
  <%= image_tag upload.uploaded_file.url(:thumb) %>
  <%= link_to 'Destroy', [:admin, upload], method: :delete, data: { remote: true, confirm: 'Are you sure?' } %>
  </span>
<% end %>

<h1 id="upload_title">上传图片</h1>
<div class="alert alert-info">
  <ul>
    <li>请上传长宽比例相同的图片.</li>
  </ul>
</div>
<% @upload = Upload.new %>
<%= render :partial => "admin/uploads/form", locals: { 
          imageable_id: @article.id, imageable_type: @article.class.name } %>

<%= link_to 'Edit', edit_admin_article_path(@article) %> |
<%= link_to 'Back', admin_articles_path %>
